﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Globalization;
using System.Runtime.Serialization;
namespace GSLMS.Entity
{
	/// <summary>
	/// 2.3.62    催收流转信息表
	/// </summary>
	[DataContract(IsReference = true)]
	public partial class TB_COL_MAINCHG: IObjectWithChangeTracker, INotifyPropertyChanged
	{
		public TB_COL_MAINCHG()
		{}
		#region Model
		private long _id;
		private long _colid;
		private long _loanid;
		private long _proid;
		private long _conid;
		private string _loanno;
		private string _custname;
		private string _custno;
		private string _productname;
		private long _productid;
		private int _chgtype;
		private Nullable<DateTime> _chgoutdate;
		private int _actionstatus;
		private string _chgoutby;
		private string _actionby;
		private Nullable<DateTime> _actiondate;
		private string _chgindep;
		private long _chgindepid;
		private string _chginname;
		private string _chginuser;
		/// <summary>
		/// 记录ID唯一
		/// </summary>
		[DataMember]
		public long ID
		{
			get{return _id;}
			set{
				if ( _id!= value)
				{
					if (ChangeTracker.ChangeTrackingEnabled && ChangeTracker.State != ObjectState.Added)
					{
						throw new InvalidOperationException("属性“ID”是对象键的一部分，不可更改。仅当未跟踪对象或对象处于“已添加”状态时，才能对键属性进行更改。");
					}
					 _id = value;
					OnPropertyChanged("ID");
				}
			}
		}
		/// <summary>
		/// 催收记录ID
		/// </summary>
		[DataMember]
		public long COLID
		{
			get{return _colid;}
			set{
				if ( _colid!= value)
				{
					 _colid = value;
					OnPropertyChanged("COLID");
				}
			}
		}
		/// <summary>
		/// 放款记录IDTb_Loan_Main.ID
		/// </summary>
		[DataMember]
		public long LOANID
		{
			get{return _loanid;}
			set{
				if ( _loanid!= value)
				{
					 _loanid = value;
					OnPropertyChanged("LOANID");
				}
			}
		}
		/// <summary>
		/// 立项申请记录ID
		/// </summary>
		[DataMember]
		public long PROID
		{
			get{return _proid;}
			set{
				if ( _proid!= value)
				{
					 _proid = value;
					OnPropertyChanged("PROID");
				}
			}
		}
		/// <summary>
		/// 合同记录ID
		/// </summary>
		[DataMember]
		public long CONID
		{
			get{return _conid;}
			set{
				if ( _conid!= value)
				{
					 _conid = value;
					OnPropertyChanged("CONID");
				}
			}
		}
		/// <summary>
		/// 贷款号
		/// </summary>
		[DataMember]
		public string LOANNO
		{
			get{return _loanno;}
			set{
				if ( _loanno!= value)
				{
					 _loanno = value;
					OnPropertyChanged("LOANNO");
				}
			}
		}
		/// <summary>
		/// 客户名称
		/// </summary>
		[DataMember]
		public string CUSTNAME
		{
			get{return _custname;}
			set{
				if ( _custname!= value)
				{
					 _custname = value;
					OnPropertyChanged("CUSTNAME");
				}
			}
		}
		/// <summary>
		/// 证件号码
		/// </summary>
		[DataMember]
		public string CUSTNO
		{
			get{return _custno;}
			set{
				if ( _custno!= value)
				{
					 _custno = value;
					OnPropertyChanged("CUSTNO");
				}
			}
		}
		/// <summary>
		/// 贷款产品
		/// </summary>
		[DataMember]
		public string PRODUCTNAME
		{
			get{return _productname;}
			set{
				if ( _productname!= value)
				{
					 _productname = value;
					OnPropertyChanged("PRODUCTNAME");
				}
			}
		}
		/// <summary>
		/// 贷款产品记录ID
		/// </summary>
		[DataMember]
		public long PRODUCTID
		{
			get{return _productid;}
			set{
				if ( _productid!= value)
				{
					 _productid = value;
					OnPropertyChanged("PRODUCTID");
				}
			}
		}
		/// <summary>
		/// 流转类型1业务部，
        ///2催收部，
        ///3法务部
		/// </summary>
		[DataMember]
		public int CHGTYPE
		{
			get{return _chgtype;}
			set{
				if ( _chgtype!= value)
				{
					 _chgtype = value;
					OnPropertyChanged("CHGTYPE");
				}
			}
		}
		/// <summary>
		/// 流转日期
		/// </summary>
		[DataMember]
		public Nullable<DateTime> CHGOUTDATE
		{
			get{return _chgoutdate;}
			set{
				if ( _chgoutdate!= value)
				{
					 _chgoutdate = value;
					OnPropertyChanged("CHGOUTDATE");
				}
			}
		}
		/// <summary>
		/// 受理状态0未受理，1已受理
		/// </summary>
		[DataMember]
		public int ACTIONSTATUS
		{
			get{return _actionstatus;}
			set{
				if ( _actionstatus!= value)
				{
					 _actionstatus = value;
					OnPropertyChanged("ACTIONSTATUS");
				}
			}
		}
		/// <summary>
		/// 转出人
		/// </summary>
		[DataMember]
		public string CHGOUTBY
		{
			get{return _chgoutby;}
			set{
				if ( _chgoutby!= value)
				{
					 _chgoutby = value;
					OnPropertyChanged("CHGOUTBY");
				}
			}
		}
		/// <summary>
		/// 受理人
		/// </summary>
		[DataMember]
		public string ACTIONBY
		{
			get{return _actionby;}
			set{
				if ( _actionby!= value)
				{
					 _actionby = value;
					OnPropertyChanged("ACTIONBY");
				}
			}
		}
		/// <summary>
		/// 受理时间
		/// </summary>
		[DataMember]
		public Nullable<DateTime> ACTIONDATE
		{
			get{return _actiondate;}
			set{
				if ( _actiondate!= value)
				{
					 _actiondate = value;
					OnPropertyChanged("ACTIONDATE");
				}
			}
		}
		/// <summary>
		/// 转入到部门
		/// </summary>
		[DataMember]
		public string CHGINDEP
		{
			get{return _chgindep;}
			set{
				if ( _chgindep!= value)
				{
					 _chgindep = value;
					OnPropertyChanged("CHGINDEP");
				}
			}
		}
		/// <summary>
		/// 转入到部门记录ID
		/// </summary>
		[DataMember]
		public long CHGINDEPID
		{
			get{return _chgindepid;}
			set{
				if ( _chgindepid!= value)
				{
					 _chgindepid = value;
					OnPropertyChanged("CHGINDEPID");
				}
			}
		}
		/// <summary>
		/// 转入到人名称
		/// </summary>
		[DataMember]
		public string CHGINNAME
		{
			get{return _chginname;}
			set{
				if ( _chginname!= value)
				{
					 _chginname = value;
					OnPropertyChanged("CHGINNAME");
				}
			}
		}
		/// <summary>
		/// 转入到人用户
		/// </summary>
		[DataMember]
		public string CHGINUSER
		{
			get{return _chginuser;}
			set{
				if ( _chginuser!= value)
				{
					 _chginuser = value;
					OnPropertyChanged("CHGINUSER");
				}
			}
		}
		#endregion Model

	#region ChangeTracking
	   
	protected virtual void OnPropertyChanged(String propertyName)
	{
	    if (ChangeTracker.State != ObjectState.Added && ChangeTracker.State != ObjectState.Deleted)
	    {
	        ChangeTracker.State = ObjectState.Modified;
	    }
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	protected virtual void OnNavigationPropertyChanged(String propertyName)
	{
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged{ add { _propertyChanged += value; } remove { _propertyChanged -= value; } }
	private event PropertyChangedEventHandler _propertyChanged;
	private ObjectChangeTracker _changeTracker;
	   
	[DataMember]
	public ObjectChangeTracker ChangeTracker
	{
	    get
	    {
	        if (_changeTracker == null)
	        {
	            _changeTracker = new ObjectChangeTracker();
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	        return _changeTracker;
	    }
	    set
	    {
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging -= HandleObjectStateChanging;
	        }
	        _changeTracker = value;
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	    }
	}
	   
	private void HandleObjectStateChanging(object sender, ObjectStateChangingEventArgs e)
	{
	    if (e.NewState == ObjectState.Deleted)
	    {
	        ClearNavigationProperties();
	    }
	}
	   
	protected bool IsDeserializing { get; private set; }
	   
	[OnDeserializing]
	public void OnDeserializingMethod(StreamingContext context)
	{
	    IsDeserializing = true;
	}
	   
	[OnDeserialized]
	public void OnDeserializedMethod(StreamingContext context)
	{
	    IsDeserializing = false;
	    ChangeTracker.ChangeTrackingEnabled = true;
	}
	   
	protected virtual void ClearNavigationProperties()
	{
	}
	
	#endregion

	}
}

